using System;
using System.Collections.Generic ;
using System.Xml;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Configuration;

/// <summary>
/// Summary description for Provider
/// </summary>
public class Provider
{
    protected string constr;

    public string ConnString
    {
        get { return constr; }
        set { constr = value; }
    }

    public Provider() { }
    public Provider(string connStr)
    {
        constr = connStr;
    }
    public void ExeQuery(string sql)
    {
        SqlConnection conn = new SqlConnection(ConnString);
        conn.Open();
        SqlCommand comm = new SqlCommand(sql, conn);
        comm.ExecuteNonQuery();
        conn.Close();
        conn.Dispose();
    }

    public DataTable ExecuteQuery(string sql)
    {
        SqlConnection conn = new SqlConnection(ConnString);
        conn.Open();
        SqlCommand  comm = new SqlCommand(sql, conn);
        SqlDataAdapter ad = new SqlDataAdapter(comm);
        DataTable dt = new DataTable();
        ad.Fill(dt);
        conn.Close();
        conn.Dispose();
        return dt;
    }
}
